from redis import StrictRedis


class Config():
    DEBUG = None
    SECRET_KEY = 'Y7ele/mPhw/UdFQCd0uDNnvoUkAtNMQ6Rli+rBKodPl5ZsMOXnfDUqpqfa/KNqbC/N0='
    SQLALCHEMY_DATABASE_URI = 'mysql://root:123456@127.0.0.1:3306/XinJing_News'
    # 动态追踪修改
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    # 指定session存储位置
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True  # session签名
    PERMANENT_SESSION_LIFETIME = 86400  # session过期时间


class Developmentconfig(Config):
    DEBUG = True


class Productionconfig(Config):
    DEBUG = False


config = {
    'Development': Developmentconfig,
    'Production': Productionconfig
}